package pro.shushi.pamirs.demo.api.model;

import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.common.VersionModel;

import java.util.List;


@Model.model(ProductStock.MODEL_MODEL)
@Model(displayName = "库存", labelFields = "name")
public class ProductStock extends VersionModel {

    private static final long serialVersionUID = -5104390780952631397L;

    public static final String MODEL_MODEL = "demo.ProductStock";

    @Field.Integer
    @Field(displayName = "班次ID", invisible = true, index = true)
    private Long productPlanId;

    @Field.Integer
    @Field(displayName = "总库存")
    private Integer total;


    @Field.Integer
    @Field(displayName = "剩余库存")
    private Integer last;


    @Field.Boolean
    @Field(displayName = "状态")
    private Boolean status;


    @Field.many2one
    @Field.Relation(relationFields = {"roomTypeId"}, referenceFields = {"id"})
    @Field(displayName = "房类型")
    private RoomType roomType;

    @Field.Integer
    @Field(displayName = "房型ID", invisible = true)
    private Long roomTypeId;

    @Field.String
    @Field.Related(related = {"roomType", "name"})
    @Field(displayName = "房型名称")
    private String roomTypeName;


    @Field.one2many
    @Field(displayName = "价格")
    @Field.Relation(relationFields = "id",referenceFields = "productStockId")
    private List<ProductPrice> productPrices;

}
